#ifndef _MYSTRING_H_
#define _MYSTRING_H_

#include <iostream>

class MyStringArray;//前置说明

class MyString
{

private:
    
    char *s; 
    int size;
    int capacity;
    void ReSize(int capacity);

public:

    MyString();
    MyString(const char* str);
    MyString(const MyString &string);
    MyString& operator=(const MyString &string);
    //Mystring(int capacity);
    ~MyString();

    MyString& operator+=(const MyString& string);
    MyString operator+(const MyString &string);

    MyString& operator-=(const MyString& string);
    MyString operator-(const MyString& string);

    char& operator[](int index);


    bool operator==(const MyString& string);
    bool operator!=(const MyString& string);
  
    //类型转换运算符重载
    operator int();
    operator double();

    //字符串切割
    // split(const MyString& delim);
    // return delim;

    friend std::ostream& operator<<(std::ostream &os,const MyString& c) ;
    //friend std::istream& operator>>(std::istream& is,MyString& string);


};

std::ostream& operator<<(std::ostream &os,const MyString& c) ;
//std::istream& operator>>(std::istream& is,MyString& string);

class MyStringArray
{
public:
    MyStringArray();
    MyStringArray(const MyStringArray &a);
    MyStringArray &operator=(const MyStringArray &a);
    ~MyStringArray();

    MyStringArray& operator+=(const MyString &str);
    friend std::ostream &operator<<(std::ostream &os,const MyStringArray &a);

private:
    MyString *array;
    int size;
    int capacity;
};


std::ostream &operator<<(std::ostream &os, const MyStringArray &a);



#endif